package org.mappland.compltres.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@TableName(value = "t_order")
public class Order {

    // 订单id
    @TableId(value = "id")
    private Integer id;

    @TableField(value = "user_id")
    private Integer userId;

    @TableField(value = "machine_id")
    private Integer machineId;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField(value = "in_time")
    private Date inTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField(value = "leave_time")
    private Date leaveTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @TableField(value = "create_time")
    private Date createTime = new Date();

    @TableField(value = "real_price")
    private Double realPrice;

    // 是否需要发票
    @TableField(value = "invoice")
    private Integer invoice;

    @TableField(value = "flag")
    private Integer flag = 0;

    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", userId=" + userId +
                ", machineId=" + machineId +
                ", inTime=" + inTime +
                ", leaveTime=" + leaveTime +
                ", createTime=" + createTime +
                ", invoice=" + invoice +
                ", flag=" + flag +
                '}';
    }
}
